import React from 'react';
import {Route,Switch,Link,Redirect} from 'react-router-dom';

import Admin from './admin.jsx';
import Login from './pages/login/login.jsx';
import Home from './pages/home/home.jsx';
import Buttons from './pages/ui/buttons/buttons.jsx';
import Modals from './pages/ui/modals/modals.jsx';

export default class App extends React.Component{
	constructor(props){
		super(props)
	};
	componentDidMount(){
		console.log('app.js-props:',this.props);
		this.props.history.replace('/admin');
	};
	render(){
		return (		
			<div className="appPage">
				<Switch>
					<Route path="/login" component={Login}></Route>
					<Route path="/admin" render={()=>
						<Admin>
							<Switch>
								<Route path="/admin/home" component={Home}></Route>
								<Route path="/admin/ui/buttons" component={Buttons}></Route>
								<Route path="/admin/ui/modals" component={Modals}></Route>
								<Redirect from="/admin" to="/admin/home"></Redirect>
							</Switch>
						</Admin>
					}></Route>
				</Switch>
			</div>
		)
	}
}


